package com.jctrip.hotel.source.xxl.wehotel;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.jctrip.hotel.common.constant.XxlJobNameConstant;
import com.jctrip.hotel.source.service.wehotel.WeHotelTaskService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author henry
 * @Date 2023/6/17 16:05
 * @Description
 */
@Component
@Slf4j
public class SyncWehotelRatesTaskPushXxlJob extends IJobHandler {
    @Resource
    private WeHotelTaskService weHotelTaskService;

    @Override
    @XxlJob(XxlJobNameConstant.SYNC_WEHOTEL_HOTEL_RATES_TASK_PUSH)
    public void execute() throws Exception {
        XxlJobHelper.log(XxlJobNameConstant.SYNC_WEHOTEL_HOTEL_RATES_TASK_PUSH + " xxl job start");
        try {
            weHotelTaskService.syncWehotelRatesTaskPush();
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }

        XxlJobHelper.log(XxlJobNameConstant.SYNC_WEHOTEL_HOTEL_RATES_TASK_PUSH + " xxl job end");
    }
}
